import request from '@/router/axios'

export function info () {
  return request({
    url: '/api/manage/account/info',
    method: 'get'
  })
}

export function baseInfo () {
  return request({
    url: '/api/manage/account/baseInfo',
    method: 'get'
  })
}

export function fetchList (query) {
  return request({
    url: '/api/manage/account/page',
    method: 'get',
    params: query
  })
}

export function addObj (obj) {
  return request({
    url: '/api/manage/account',
    method: 'post',
    data: obj
  })
}

export function getObj (id) {
  return request({
    url: '/api/manage/account/' + id,
    method: 'get'
  })
}

export function delObj (id) {
  return request({
    url: '/api/manage/account/' + id,
    method: 'delete'
  })
}

export function putObj (obj) {
  return request({
    url: '/api/manage/account',
    method: 'put',
    data: obj
  })
}

export function getDetailsByPhone (obj) {
  return request({
    url: '/api/manage/account/phone/' + obj,
    method: 'get'
  })
}

// 员工修改密码
export function editPassword (obj) {
  return request({
    url: '/api/manage/account/editPassword',
    method: 'put',
    params: obj
  })
}

// 管理员修改员工邮箱
export function editEmail (obj) {
  return request({
    url: '/api/manage/account/editEmail',
    method: 'put',
    params: obj
  })
}

// 员工绑定/更绑邮箱
export function bindEmail (obj) {
  return request({
    url: '/api/manage/account/bindEmail',
    method: 'put',
    params: obj
  })
}

// 管理员修改员工邮箱
export function editPhone (obj) {
  return request({
    url: '/api/manage/account/editPhone',
    method: 'put',
    params: obj
  })
}

// 员工绑定/更绑手机号
export function bindPhone (obj) {
  return request({
    url: '/api/manage/account/bindPhone',
    method: 'put',
    params: obj
  })
}

// 管理员修改员工账号密码
export function editUsernamePassword (obj) {
  return request({
    url: '/api/manage/account/editUsernamePassword',
    method: 'put',
    params: obj
  })
}

// 员工修改自己的资料
export function selfEdit (obj) {
  return request({
    url: '/api/manage/account/selfEdit',
    method: 'put',
    data: obj
  })
}